package com.sangu.controller;

import com.sangu.common.R;
import com.sangu.entity.Article;
import com.sangu.service.ArticleService;
import com.sangu.vo.HotArticleVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("article")
public class ArticleController {

    @Autowired
    ArticleService articleService;


    @GetMapping("list")
    public List<Article> test(){
        return articleService.list();
    }

    @GetMapping("hotArticleList")
    public R hotArticleList(){
        List<HotArticleVO> list = articleService.hotArticleList();
        return R.ok(list);
    }


}
